<?php
session_start();
if (isset($_SESSION["username"])) {
?>
  <?php require_once('common/header.php'); ?>
  <!--页面主要内容-->
<main class="lyear-layout-content">
      
      <div class="container-fluid">
        
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <ul class="nav nav-tabs page-tabs">
                <li class="active"> <a href="setrename.php">实名配置</a> </li>
             
              </ul>
          <?php
            include_once("../untils/conn.php");
            
            // 查询type为tencent的系统信息
            $sql = "SELECT * FROM system WHERE type = 'tencent'";
            $data = mysqli_query($con, $sql);
            $result = mysqli_fetch_row($data);
            
            // 将查询结果存储到对应的变量中
            $tx_appid = $result[2];
            $tx_appkey = $result[3];
            
            // 查询type为aliyun的系统信息
            $sql = "SELECT * FROM system WHERE type = 'aliyun'";
            $data = mysqli_query($con, $sql);
            $result = mysqli_fetch_row($data);
            
            // 将查询结果存储到对应的变量中
            $al_appid = $result[2];
            $al_appkey = $result[3];
            
            $sql = "SELECT * FROM system WHERE type = 'xitong'";
            $data = mysqli_query($con, $sql);
            $result = mysqli_fetch_row($data);
            
            // 将查询结果存储到对应的变量中
            $auto = $result[10];
            ?>

      <div class="">
        <div class="card-body">
          <form class="form-horizontal" action="controller/doUPresys.php" method="POST">
            <div class="form-group" >
                <p style= "color:red;margin-left:18px;">优先级最高，六月烟云自研正则表达，验证身份证极其精确！(请将代理实名状态默认改为0）</p>
                <label class="col-xs-12">系统自动实名：</label>
                <div class="col-xs-12">
                    <select class="form-control" name="auto">
                        <?php
                        $auto = $result[10]; 
                        $options = array(
                            "0" => "关闭",
                            "1" => "开启"
                        );
                        foreach ($options as $value => $label) {
                            $selected = ($auto == $value) ? "selected" : "";
                            echo "<option value=\"$value\" $selected>$label</option>";
                        }
                        ?>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <p style= "color:red;margin-left:18px;">腾讯云和阿里云随机填写一个即可，不填写则需要手动审核~,填写两个默认腾讯云</p>
              <label for="title" class="col-xs-12">腾讯云appid：</label>
              <div class="col-xs-12">
                <input type="text" class="form-control" name="tx_appid" placeholder="输入腾讯云appid" value="<?php echo $tx_appid ?>" >
              </div>
            </div>
            <div class="form-group">
              <label for="title" class="col-xs-12">腾讯appkey：</label>
              <div class="col-xs-12">
                <input type="text" class="form-control" name="tx_appkey" placeholder="输入腾讯云appkey" value="<?php echo $tx_appkey ?>" >
              </div>
            </div>
            <div class="form-group">
              <label for="title" class="col-xs-12">阿里云appid：</label>
              <div class="col-xs-12">
                <input type="text" class="form-control" name="al_appid" placeholder="输入阿里云appid" value="<?php echo $al_appid ?>" >
              </div>
            </div>
            <div class="form-group">
              <label for="title" class="col-xs-12">阿里云key：</label>
              <div class="col-xs-12">
                <input type="text" class="form-control" name="al_key" placeholder="请输入阿里云appkey" value="<?php echo $al_appkey ?>" >
              </div>
            </div>
            
            <div class="form-group">
              <input type="hidden" name="kefu" value="">
              <div class="offset-2 col-xs-12">
                <button class="btn btn-success" type="submit" value="添加">确认修改</button>
                <!-- <button class="btn btn-danger ml-3" type="reset" value="重置">返回</button> -->
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </main>
  <!--End 页面主要内容-->
  <?php require_once('common/footer.php'); ?>
<?php
} else {
  echo "<script>alert('您尚未登录，没有权限访问该页面');location.href='login.php';</script>";
}
